
local PANEL = {}

/*---------------------------------------------------------
   Name: Init
---------------------------------------------------------*/
function PANEL:Init()
	
	self.SpawnButton = vgui.Create( "Button", self )
	
	self.DeleteButton = vgui.Create( "ImageButton", self )
	self.DeleteButton:SetMaterial( "gui/silkicons/exclamation" )
	self.DeleteButton:SetTooltip( "Remove" )
	
end

/*---------------------------------------------------------
   Name: ApplySchemeSettings
---------------------------------------------------------*/
function PANEL:ApplySchemeSettings()
	
end

/*---------------------------------------------------------
   Name: Setup
---------------------------------------------------------*/
function PANEL:Setup( in_table )	

end

/*---------------------------------------------------------
   Name: SetText
---------------------------------------------------------*/
function PANEL:SetItemText( text )

	self.SpawnButton:SetText( text )

end

/*---------------------------------------------------------
   Name: SetID
---------------------------------------------------------*/
function PANEL:SetID( id )

	self.SpawnButton.DoClick = function() LocalPlayer():ConCommand( "tool_duplicator_select " .. id .. "\n" ) end
	self.DeleteButton.DoClick = function() LocalPlayer():ConCommand( "tool_duplicator_remove " .. id .. "\n" ) end
	
	self:InvalidateLayout()

end

/*---------------------------------------------------------
   Name: PerformLayout
---------------------------------------------------------*/
function PANEL:PerformLayout()	

	local Border = 3

	self.DeleteButton:SizeToContents()
	self.DeleteButton:SetSize( self.DeleteButton:GetWide(), self.DeleteButton:GetTall() * 1.25 )
	self.DeleteButton:SetPos( self:GetWide() - Border - self.DeleteButton:GetWide(), Border )
	
	self.SpawnButton:SetSize( self:GetWide() - self.DeleteButton:GetWide() - Border * 3, self.DeleteButton:GetTall() )
	self.SpawnButton:SetPos( Border, Border )
	
	self:SetSize( self:GetWide(), self.DeleteButton:GetTall() + Border * 2 )
	
end

/*---------------------------------------------------------
   Name: Paint
---------------------------------------------------------*/
function PANEL:Paint()

	local bgColor = Color( 0, 0, 0, 150 )
	
	if ( self.Armed ) then
		bgColor = Color( 0, 180, 255, 250 )
	end
	
	draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), bgColor )
	
	return false

end

vgui.Register( "DuplicatorButton", PANEL, "Panel" )

